package com.connect.bag1;
// i am hanging out.
import java.sql.*;

public class DisplayJDBCVersionData {
	public static void main(String[] args) {
		Connection con = null;
		try {

			Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
			con = DriverManager.getConnection
			           ("jdbc:microsoft:sqlserver://127.0.0.1:1433;","sa","123sql");		
			// Connection is ready to use
			DatabaseMetaData meta = con.getMetaData();
			System.out.println("Driver name: " + meta.getDriverName());
			System.out.println("Driver version: " + meta.getDriverVersion());
			System.out.println("Server name: " + meta.getDatabaseProductName());
			System.out.println("Server version: "
					+ meta.getDatabaseProductVersion());
			System.out.println("Connection URL: " + meta.getURL());
			System.out.println("Login name: " + meta.getUserName());

		} catch (java.lang.ClassNotFoundException e) {
			System.err.println("ClassNotFoundException: " + e.getMessage());
		} catch (SQLException e) {
			System.err.println("SQLException: " + e.getMessage());
		}
	}
}